<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />

<atleap:constants className="com.blandware.atleap.webapp.taglib.core.grid.util.FilterConditions" scope="page" />
<atleap:form action="/grid/dateFilter.do" method="POST">
	<table align=left cellpadding="0" cellspacing="0" border="0" width="90%" class="filter-table">
		<tr>
			<td colspan="4" align="right" class="filter-ErrorMessage" width="25%"><atleap:messages property="firstValue" /></td>
		</tr>
		<tr>
			<td class="filter-FildName">
				<c:choose>
					<c:when test="${dateFilterForm.fieldKey != null}">
						<atleap:message key="${dateFilterForm.fieldKey}" />
					</c:when>
					<c:otherwise>
						<c:out value="${dateFilterForm.fieldName}" escapeXml="true" />
					</c:otherwise>
				</c:choose>
			</td>
			<td class="filter-condition">
				<html:select property="firstCondition">
					<html:option key="core.grid.filter.isNull" value="${pageScope.OBJECT_IS_NULL}" />
					<html:option key="core.grid.filter.isNotNull" value="${pageScope.OBJECT_IS_NOT_NULL}" />
					<html:option key="core.grid.filter.date.before" value="${pageScope.DATE_BEFORE}" />
					<html:option key="core.grid.filter.equal" value="${pageScope.DATE_EQUAL}" />
					<html:option key="core.grid.filter.notEqual" value="${pageScope.DATE_NOT_EQUAL}" />
					<html:option key="core.grid.filter.date.after" value="${pageScope.DATE_AFTER}" />
				</html:select>
			</td>
			<td class="dateFilter-value">
				<html:text property="firstValue" readonly="true"/>
			</td>
			<td>
				<atleap:message key="core.commons.buttons.select" var="selectMsg" />
				<atleap:calendar fieldName="document.forms[0].firstValue" showYearNavigation="true" showYearNavigationInput="true">
					<img src="<atleap:rewriteUrl href="/images/theme/${appConfig['adminCssTheme']}/calendar.gif" />" border="0" height="20" width="20" alt="${selectMsg}" title="${selectMsg}"  />
				</atleap:calendar>
			</td>
		</tr>
		<tr>
			<td class="filter-logicCopula" align="center">
				<html:select style="width:50px;" property ="logicCopula">
					<html:option key="core.grid.filter.logicCopulaAnd" value="${pageScope.LOGIC_COPULA_AND}" />
					<html:option key="core.grid.filter.logicCopulaOr" value="${pageScope.LOGIC_COPULA_OR}" />
				</html:select>
			</td>
			<td colspan="3"></td>
		</tr>
		<tr>
			<td colspan="4" align="right" class="filter-ErrorMessage"><atleap:messages property="secondValue" /></td>
		</tr>
		<tr>
		   <td class="filter-FildName">
				<c:choose>
					<c:when test="${dateFilterForm.fieldKey != null}">
						<atleap:message key="${dateFilterForm.fieldKey}" />
					</c:when>
					<c:otherwise>
						<c:out value="${dateFilterForm.fieldName}" escapeXml="true" />
					</c:otherwise>
				</c:choose>
			</td>
			<td class="filter-condition">
				<html:select property="secondCondition">
					<html:option key="core.grid.filter.conditionNotSet" value="${pageScope.CONDITION_NOT_SET}" />
					<html:option key="core.grid.filter.isNull" value="${pageScope.OBJECT_IS_NULL}" />
					<html:option key="core.grid.filter.isNotNull" value="${pageScope.OBJECT_IS_NOT_NULL}" />
					<html:option key="core.grid.filter.date.before" value="${pageScope.DATE_BEFORE}" />
					<html:option key="core.grid.filter.equal" value="${pageScope.DATE_EQUAL}" />
					<html:option key="core.grid.filter.notEqual" value="${pageScope.DATE_NOT_EQUAL}" />
					<html:option key="core.grid.filter.date.after" value="${pageScope.DATE_AFTER}" />
				</html:select>
			</td>
			<td class="dateFilter-value">
				<html:text property="secondValue" readonly="true"/>
			</td>
			<td>
				<atleap:message key="core.commons.buttons.select" var="selectMsg" />
				<atleap:calendar fieldName="document.forms[0].secondValue" showYearNavigation="true" showYearNavigationInput="true">
					<img src="<atleap:rewriteUrl href="/images/theme/${appConfig['adminCssTheme']}/calendar.gif" />" border="0" height="20" width="20" alt="${selectMsg}" title="${selectMsg}"  />
				</atleap:calendar>
			</td>
		</tr>
		<tr>
			<td colspan="4" align="center" nowrap="nowrap">
				<atleap:submit styleClass="button" onclick="if ( window.opener == null ) { window.close(); return false; }; bCancel=false;" style="width: 120px;"><atleap:message key="core.grid.filter.submit" /></atleap:submit>
				<atleap:cancel property="clearFilter" styleClass="button"><atleap:message key="core.grid.filter.clear" /></atleap:cancel>
				<atleap:cancel styleClass="button" onclick="bCancel=true; if ( window.opener != null ) { window.opener.focus(); }; window.close(); return false;"><atleap:message key="core.grid.filter.cancel" /></atleap:cancel>
			</td>
		 </tr>
	</table>
	<html:hidden property="fieldName" />
	<html:hidden property="gridName" />
	<html:hidden property="pageUrl" />
	<html:hidden property="fieldKey" />
	<html:hidden property="rowIterators" />
</atleap:form>
